<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>账户信息</title> $!{include("import_js_css.html")}
<!--#var(Member member)-->
</head>
<body>
	$!{include("header.html")}
	<div class="container menu_all">
		<div class="panel panel-info">
			$!{include("memberHeader.html")}
			<div class="panel-mrs-info">
				$!{include("member_info_tab.html")}
				<div class="panel-hxcd-info">
					<!-- 充值 -->
					<label for="yue" class="panel-common-label font-size-21">余额</label>
					<div class="panel-commoner-label font-size-16">${yje}</div>
					<label for="score" class="panel-common-label font-size-21">积分</label>
					<div class="panel-commoner-label font-size-16">${score}</div>

					<label for="recharge" class="panel-smarll-label">充值</label>
					<div class="panel-common-div">
					<!-- /[^\d.]/g, '' 可以输入.的-->
						<input type="text" class="form-control" onkeydown="this.value=this.value.replace(/[^\d.]/g, '')" onkeyup="inputMoney()" name="recharge" id="recharge" required>
					</div>
					<label for="money" class="panel-smarll-label">实收</label>
					<div class="panel-common-div">
						<input type="text" class="form-control" name="money" id="money" required>
					</div>
					<br /> <br /> <br /> <label for="type" class="panel-common-label">支付方式</label>
					<div class="panel-common-div" style="margin-right:35px;">
						<select name="memberSelect" class="selectpicker show-tick" id="type" data-width="100%">
							<option name="type" value=""> </option>
							<option name="type" value="1">现金</option>
							<option name="type" value="2">刷卡</option>
							<option name="type" value="3">转账</option>
							<option name="type" value="4">支票</option>
						</select>
					</div>
					<label for="remarks" class="panel-smarll-label">备注</label>
					<div class="panel-common-div" style="margin-right:265px;">
						<textarea id="txtRemarks" name="remarks" class="form-control act-remarks-2" style="height: 30px !important; resize: none; width: 425px;"></textarea>
					</div>
					<div class="col-sm-1">
						<button id="rechargeButton" type="button" class="btn btn-default btn-ade-default">充值</button>
					</div>
					<!-- 显示信息列表 -->
					<div class="act-list">
						<div class="div_search_result clear">
							<div class="panel-heading panel-result-title">
								<h3 class="panel-title">充值记录</h3>
							</div>
							<form name="rechargeForm" action="yueyogaAdmin/toMemberRecharge.jhtml">
								<input type="hidden" name="memberId" value="${member.memberid}"> <input type="hidden" name="rechargePageNo" id="rechargeHidPageNo" value="${rechargePageNo}" /> <input type="hidden" name="pageNo" id="hidPageNo" value="${pageNo}" />
							</form>
							<div>$!{include("member_recharge_record_list.html")}</div>
						</div>
					</div>
					<br><br> <label for="type" class="panel-common-label">提取方式</label>
					<div class="panel-common-div" style="margin-right:35px;">
						<select id="tqfs" name="tqfs" class="selectpicker show-tick" data-width="100%">
							<option name="type" value=""> </option>
							<option name="type" value="1">现金</option>
							<option name="type" value="2">刷卡</option>
							<option name="type" value="3">转账</option>
							<option name="type" value="4">支票</option>
						</select>
					</div>
					<label for="tiqu" class="panel-smarll-label">提取</label>
					<div class="panel-common-div">
						<input type="text" class="form-control" style="width:180px;" onkeyup="this.value=this.value.replace(/\D/g,'')" name="tiqu" id="tiqu" required>
					</div>
					<label for="remarks_tiqu" style="margin-left: 5px;" class="panel-smarll-label">备注</label>
					<div class="panel-common-div" style="margin-right:265px;">
						<textarea id="txtRemarks_tiqu" name="remarks_tiqu" class="form-control" style="height: 30px !important; resize: none; width: 425px;"></textarea>
					</div>
					<div class="col-sm-1">
						<button id="tiquButton" type="button" class="btn btn-default btn-ade-default">提取</button>
					</div>
					<div class="act-list">
						<div class="div_search_result clear">
							<div class="panel-heading panel-result-title">
								<h3 class="panel-title">提取记录</h3>
							</div>
							<div>$!{include("member_recharge_tiqu_list.html")}</div>
						</div>
					</div>
				</div>

				
			</div>
		</div>
	</div>
</body>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#tiquButton").click(function() {
				var memberId = "${member.memberid}";
				var tiqu = $("input[name='tiqu']").val();
				var tqfs = $("#tqfs").val();
				var remarks_tiqu = $("textarea[name='remarks_tiqu']").val();
				if(!tqfs){
					alert("请选择提取方式");
					return;
				}
				if (!tiqu) {
					alert("请确认提取金额!");
					return;
				}
				$.post("yueyogaAdmin/tiquRecharge.jhtml",
					{
						"memberId" : memberId,
						"tiqu" : tiqu,
						"remarks_tiqu":remarks_tiqu,
						"tqfs":tqfs
					},
					function(msg) {
						if("提取成功!"==msg){
							location.replace(location);
						}else{
							error(msg);
						}
					});
			    });

				$("#rechargeButton").click(function() {
					var memberId = "${member.memberid}";
					var recharge = $("#recharge").val();
					var money = $("input[name='money']").val();
					var type = $("#type").val();
					var remarks = $("textarea[name='remarks']").val();

					if(!type){
						alert("请选择充值方式");
						return;
					}
					if (!recharge) {
						alert("请确认充值金额!");
						return;
					}
					if (!money) {
						alert("请确认实收金额!");
						return;
					}
					
					$.post(
						"yueyogaAdmin/addRecharge.jhtml",
						{
							"memberId" : memberId,
							"recharge" : recharge,
							"money" : money,
							"type" : type,
							"remarks" : remarks
						},
						function(result) {
							var res = eval("("+ result+ ")");
							if (res.success) {
								$("#rechargeRecord").append("<tr><td>"
									+ res.item.recharge
									+ "</td><td>"
									+ res.item.money
									+ "</td><td>"
									+ res.item.type
									+ "</td><td>"
									+ res.item.remarks
									+ "</td><td>"
									+ res.item.username
									+ "</td></tr>"
								);
								location.replace(location);
							} else {
								alert(res.msg);
							}
						}
					);
				});
				
				$("#type").select2({
					width: "100%",
					minimumResultsForSearch: -1
				});
				
				$("#tqfs").select2({
					width: "100%",
					minimumResultsForSearch: -1
				});
			});
		function inputMoney(){
			var czje = $("#recharge").val();
			$("#money").val(czje);
		}
	</script>
</html>
